Telegram Group & Telegram Channel
Каждая хорошо спроектированная консольная утилита должна принимать аргументы в виде опций (например, -h или --help), опций с параметрами (--log-level 2) или позиционных параметров (cp file1 file2).

Опции отличаются от позиционных параметров тем, что начинаются с одного или двух дефисов. Проблемы возникают, когда позиционные аргументы тоже начинаются с дефиса — например, если нужно удалить файл с именем -rf: команда rm -rf в таком случае не работает как ожидается.

Общепринятый способ решения этой проблемы — поддержка разделителя --. Аргументы, идущие после --, никогда не интерпретируются как опции:


$ echo test > -rf
$ cat -rf
cat: invalid option -- 'r'
Try 'cat --help' for more information.
$ cat -- -rf
test
$ rm -- -rf
$ cat -- -rf
cat: -rf: No such file or directory


Модуль argparse автоматически обрабатывает -- за тебя.

👉@BookPython



tg-me.com/BookPython/3660
Create:
Last Update:

Каждая хорошо спроектированная консольная утилита должна принимать аргументы в виде опций (например, -h или --help), опций с параметрами (--log-level 2) или позиционных параметров (cp file1 file2).

Опции отличаются от позиционных параметров тем, что начинаются с одного или двух дефисов. Проблемы возникают, когда позиционные аргументы тоже начинаются с дефиса — например, если нужно удалить файл с именем -rf: команда rm -rf в таком случае не работает как ожидается.

Общепринятый способ решения этой проблемы — поддержка разделителя --. Аргументы, идущие после --, никогда не интерпретируются как опции:


$ echo test > -rf
$ cat -rf
cat: invalid option -- 'r'
Try 'cat --help' for more information.
$ cat -- -rf
test
$ rm -- -rf
$ cat -- -rf
cat: -rf: No such file or directory


Модуль argparse автоматически обрабатывает -- за тебя.

👉@BookPython

BY Библиотека Python разработчика | Книги по питону


Warning: Undefined variable $i in /var/www/tg-me/post.php on line 283

Share with your friend now:
tg-me.com/BookPython/3660

View MORE
Open in Telegram


Библиотека Python разработчика | Книги по питону Telegram | DID YOU KNOW?

Date: |

Importantly, that investor viewpoint is not new. It cycles in when conditions are right (and vice versa). It also brings the ineffective warnings of an overpriced market with it.Looking toward a good 2022 stock market, there is no apparent reason to expect these issues to change.

Telegram hopes to raise $1bn with a convertible bond private placement

The super secure UAE-based Telegram messenger service, developed by Russian-born software icon Pavel Durov, is looking to raise $1bn through a bond placement to a limited number of investors from Russia, Europe, Asia and the Middle East, the Kommersant daily reported citing unnamed sources on February 18, 2021.The issue reportedly comprises exchange bonds that could be converted into equity in the messaging service that is currently 100% owned by Durov and his brother Nikolai.Kommersant reports that the price of the conversion would be at a 10% discount to a potential IPO should it happen within five years.The minimum bond placement is said to be set at $50mn, but could be lowered to $10mn. Five-year bonds could carry an annual coupon of 7-8%.

Библиотека Python разработчика | Книги по питону from us


Telegram Библиотека Python разработчика | Книги по питону
FROM USA